# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>

pkgname=espup
pkgver=0.9.0
pkgrel=1
pkgdesc="Tool for installing and maintaining ESP Rust ecosystem"
url='https://github.com/esp-rs/espup'
arch=('loong64' 'x86_64')
license=('MIT' 'Apache-2.0')
depends=('curl' 'git' 'ldproxy' 'libbz2.so' 'liblzma.so' 'pkg-config' 'python' 'python-pip' 'udev')
makedepends=('cargo')
options=(!lto)
source=(https://github.com/esp-rs/${pkgname}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('69a45c563718db38e3c300d309faeb118a52156c6ca9016bfa3fb84559510fe2')
b2sums=('9d4079ee8f10a49acc56458672514e447dfc5de648dacea26d00e9460ad6b1563119e20349a87eddd01907298abdada43995b68553e5f5023d49bbe1474823ab')

prepare() {
  cd "${pkgname}-${pkgver}"
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd ${pkgname}-${pkgver}
  cargo build --frozen --release
}

check() {
  cd ${pkgname}-${pkgver}
  cargo test --frozen
  target/release/${pkgname} --help
}

package() {
  cd ${pkgname}-${pkgver}
  install -Dm 755 -t "${pkgdir}/usr/bin" \
    target/release/${pkgname}
}

# vim: ts=2 sw=2 et:
